<script setup lang="ts">
import { ref } from "vue";
import ReCol from "@/components/ReCol";
import { FormProps } from "./utils/types";
import { usePublicHooks } from "@/views/system/utils/system";

const props = withDefaults(defineProps<FormProps>(), {
  formInline: () => ({
    userAccount: "",
    userDep: "",
    userNiCheng: "",
    userState: ""
  })
});
const ruleFormRef = ref();
const { switchStyle } = usePublicHooks();
const newFormInline = ref(props.formInline);

function getRef() {
  return ruleFormRef.value;
}

defineExpose({ getRef });
</script>

<template>
  <el-form ref="ruleFormRef" :model="newFormInline" label-width="82px">
    <el-row :gutter="30">
      <re-col :value="12" :xs="24" :sm="24">
        <el-form-item label="用户名称" prop="userAccount">
          <el-input
            v-model="newFormInline.userAccount"
            clearable
            placeholder="请输入用户名称"
          />
        </el-form-item>
      </re-col>
      <re-col :value="12" :xs="24" :sm="24">
        <el-form-item label="部门" prop="userDep">
          <el-input
            v-model="newFormInline.userDep"
            clearable
            placeholder="请输入部门"
          />
        </el-form-item>
      </re-col>

      <re-col :value="12" :xs="24" :sm="24">
        <el-form-item label="用户昵称" prop="userNiCheng">
          <el-input
            v-model="newFormInline.userNiCheng"
            clearable
            placeholder="请输入用户昵称"
          />
        </el-form-item>
      </re-col>

      <re-col :value="12" :xs="24" :sm="24">
        <el-form-item label="用户状态" prop="userState">
          <el-switch
            v-model="newFormInline.userState"
            inline-prompt
            :active-value="1"
            :inactive-value="0"
            active-text="启用"
            inactive-text="停用"
            :style="switchStyle"
          />
        </el-form-item>
      </re-col>
    </el-row>
  </el-form>
</template>
